package org.dromara.system.enums;


import lombok.Getter;
import org.springframework.util.StringUtils;

/**
 * Created by fly on 2014/12/11.
 */
@Getter
public enum SysRoleCodeEnum {
    /**
     *
     */

    supperadmin("supperadmin", "超级管理员", 1),

    admin("admin", "管理员", 2),

    user("user", "用户", 3),


    tourist("tourist", "访客", 4);


    SysRoleCodeEnum(String code, String desc, Integer seq) {
        this.code = code;
        this.desc = desc;
        this.seq = seq;
    }


    String code;
    String desc;
    Integer seq;

    public static SysRoleCodeEnum valueOfCode(String code) {

        if (StringUtils.isEmpty(code)) {
            return null;
        }
        for (SysRoleCodeEnum status : SysRoleCodeEnum.values()) {
            if (status.getCode().toLowerCase().equals(code.toLowerCase())) {
                return status;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return code + ":" + desc;
    }

}
